package com.zhl.scheduling.controller;

import com.zhl.scheduling.model.bo.MachineListQueryBO;
import com.zhl.scheduling.model.entity.Machine;
import com.zhl.scheduling.model.vo.ResultVO;
import com.zhl.scheduling.service.MachineService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author: ZhangLu In DLUT
 * @since: 1.0.0
 * @Description:提供对机器操作的相关接口
 */
@Api(value = "提供机器增删改查等相关接口", tags = "机器相关")
@RestController
@CrossOrigin
@RequestMapping("/machine")
public class MachineController {

    @Resource
    private MachineService machineService;

    @ApiOperation("根据条件获取机器列表")
    @PostMapping("/getList")
    public ResultVO getList(@RequestBody MachineListQueryBO machineListQueryBO){
        return machineService.queryByConditions(machineListQueryBO);
    }

    @ApiOperation("更新机器信息")
    @PostMapping("/update")
    public ResultVO update(@RequestBody Machine machine){
        return machineService.update(machine);
    }

    @ApiOperation("增加机器信息")
    @PostMapping("/add")
    public ResultVO add(@RequestBody Machine machine){
        return machineService.add(machine);
    }
}
